﻿@using SCMS.Resources
@model SCMS.UI.Models.POSingleQuoteModel
@{AjaxOptions ajaxOpts = new AjaxOptions
      {
          UpdateTargetId = "PODiv",
          LoadingElementId = "loading",
          HttpMethod = "Post",
          Url = Url.Action("SavePOSingleQ")

      };}
<script src="@Url.Content("~/Scripts/js/jquery-1.7.2.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<div class="partialViewCard">
    <div class="partialViewCardHeader">
        <h3>
            @Resources_frank.PurchaseOrder_LoadSingleQ_NewPO:: &nbsp;@Model.POEntiy.RefNumber&nbsp; (@Resources_frank.PurchaseOrder_String_SingleQuote)</h3>
    </div>
    <br />
    @using (Ajax.BeginForm(null, null, ajaxOpts, new { @class = "form" }))
    {
        @Html.ValidationSummary(true)
        <table width="98%" align="center" style="margin-left: auto; margin-right: auto;">
            <tr>
                <th width="33%">    
                    @Resources_frank.Global_String_Date
                </th>
                <th width="33%">
                    @Resources_frank.CompletionCerticate_ViewCC_PONo
                </th>
                <th colspan="2">
                    @Resources_frank.Global_String_Currency
                </th>
            </tr>
            <tr>
                <td>
                    @Html.EditorFor(m => m.PODate)
                    @Html.ValidationMessageFor(m => m.PODate)
                </td>
                <td>
                    @Html.TextBoxFor(model => model.POEntiy.RefNumber, new { @readonly = "readonly"})
                    @Html.HiddenFor(model => model.POEntiy.Id)
                </td>
                <td colspan="2">
                    @Html.DropDownListFor(m => m.CurrencyId, Model.Currencies, Resources_frank.Global_String_PleaseSelect)
                    @Html.ValidationMessageFor(m => m.CurrencyId)
                </td>
            </tr>
            <tr>
                <th>
                    @Resources_frank.Global_String_ProjectProgramme
                </th>
                <th>
                    @Resources_frank.Budget_CategoryList_ProjectNo
                </th>
                <th colspan="2">
                    @Resources_frank.Global_String_Supplier
                </th>
            </tr>
            <tr>
                <td>
                    @Html.DropDownListFor(x => x.ProjectId, Model.Projects, Resources_frank.Global_String_PleaseSelect, new { @id = "dplProject", onchange = "javascript:selectedIndexChangePONos(this)" })                    
                    @Html.ValidationMessageFor(x => x.ProjectId)
                </td>
                <td>
                    <div id="ProjectNoDiv">
                        @Html.DropDownListFor(x => x.ProjectDonorId, Model.ProjectNos, Resources_frank.Global_String_PleaseSelect, new { @id = "dplProNo", onchange = "javascript:selectedIndexChange(this)" })
                        @Html.ValidationMessageFor(x => x.ProjectDonorId)
                    </div>
                </td>
                <td id="supplierDiv" width="33%">
                    @Html.DropDownListFor(x => x.supplierID, Model.suppliers, Resources_frank.Global_String_PleaseSelect)
                    @Html.ValidationMessageFor(x => x.supplierID)
                </td>
                <td width="1%" title="@Resources_frank.PurchaseOrder_AddNewSupplier4PO_AddNewSupplier">
                    <a href="#" onclick="ShowDialogue('@Resources_frank.PurchaseOrder_AddNewSupplier4PO_AddNewSupplier');sendRequest('/PurchaseOrder/AddNewSupplier4PO', 'popup-page', 'popup-loading');CenterPopup();"><img src="../../Content/images/Add-Green-Button-icon.png" alt="@Resources_frank.PurchaseOrder_AddNewSupplier4PO_AddNewSupplier" /></a>
                </td>
            </tr>
            <tr>            
                <th>
                    @Resources_frank.PurchaseOrder_String_QuotationRef
                </th>
                <th>
                    @Resources_frank.Global_String_PaymentTerms
                </th>
                <th colspan="2">
                    @Resources_frank.Global_String_ShippingTerms
                </th>
            </tr>
            <tr>
                <td>
                    @Html.TextBoxFor(model => model.QuatationRef)
                    @Html.ValidationMessageFor(model => model.QuatationRef)
                </td>
                <td>
                    @Html.DropDownListFor(x => x.paymentTerm, Model.PaymentTerms, Resources_frank.Global_String_PleaseSelect)
                    @Html.ValidationMessageFor(x => x.paymentTerm)
                </td>
                <td colspan="2">
                    @Html.DropDownListFor(x => x.shippingTerm, Model.ShippingTerms, Resources_frank.Global_String_PleaseSelect)
                    @Html.ValidationMessageFor(x => x.shippingTerm)
                </td>
            </tr>
            <tr>
                <th>
                    @Resources_frank.PurchaseOrder_LoadSingleQ_LatestDeliveryDate
                </th>
                <th>
                    @Resources_frank.Global_String_DRCRemarks
                </th>
                <th colspan="2">
                    @Resources_frank.Global_String_DeliveryAddress
                </th>
            </tr>
            <tr>
                <td>
                    @Html.EditorFor(model => model.deliveryDate)
                    @Html.ValidationMessageFor(model => model.deliveryDate)
                </td>
                <td>                    
                    @Html.EditorFor(model => model.POEntiy.Remarks)
                </td>
                <td id="locationDiv">
                    @Html.DropDownListFor(x => x.deliveryAddressID, Model.deliveryAddress, Resources_frank.Global_String_PleaseSelect, new { id = "deliveryAddressID"})
                    @Html.ValidationMessageFor(x => x.deliveryAddressID)
                </td>
                <td width="1%" title="@Resources_frank.OrderRequest_AddNewLocation4OR_AddNewDelivAddress">
                    <a href="#" onclick="ShowDialogue('@Resources_frank.OrderRequest_AddNewLocation4OR_AddNewDelivAddress');sendRequest('/PurchaseOrder/AddNewLocation4PO', 'popup-page', 'popup-loading');CenterPopup();"><img src="../../Content/images/Add-Green-Button-icon.png" alt="@Resources_frank.OrderRequest_AddNewLocation4OR_AddNewDelivAddress" /></a>
                </td>
            </tr>
        </table>
        <br />
        <table width="98%" align="center">
            <tr>
                <td width="50%">
                    @Ajax.ActionLink("<<" + Resources_frank.Global_String_Back, "Index", new { id = "ChoosePOTye" }, new AjaxOptions
                    {
                        UpdateTargetId = "PODiv",
                        LoadingElementId = "loading",
                        Url = Url.Action("ChoosePOTye")
                    }, new { @class = "btn"})
                </td>
                <td align="right" width="50%">
                    <input type="submit" class="btn green" value="@Resources_frank.Global_String_Proceed" />
                </td>
            </tr>
        </table>
    }
</div>
